home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot / sun3.md / start.s < prev    next >
Encoding:
Text File  |  1990-08-14  |  1.5 KB  |  66 lines

  1. /*-
  2.  * start.s --
  3.  *    Function to start the loaded kernel running.
  4.  *
  5.  * Copyright (c) 1987 by the Regents of the University of California
  6.  *
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *
  16.  */
  17.     .data
  18. _rcsid:
  19.     .ascii "$Header$ SPRITE (Berkeley)\0"
  20.     .even
  21. hello:
  22.     .ascii "Hi there! d0 = %x\11\0"
  23.     .text
  24.     
  25. #define ASM    This is assembler code!
  26. #include    "boot.h"
  27.  
  28.     .globl    _end, _edata, _main
  29.  
  30.     .globl    start
  31. start:
  32.     movw    #0x2700,sr    /* Disable interrupts */
  33.     lea    0,a0        /* Start shifting from 0 */
  34.     lea    BOOT_START,a1    /* Move to BOOT_START */
  35.     movl    #_end,d1    /* Figure how many bytes need moving */
  36.     subl    a1,d1        /* by subtracting the destination of the
  37.                  * move from the end of our image */
  38.     lsrl    #2,d1        /* Count in longwords */
  39. loop:
  40.     movl    a0@+,a1@+
  41.     dbra    d1,loop
  42.  
  43. /*
  44.  * Clear out any bss data we've got, now that we're in the right position.
  45.  */
  46.     lea    _edata,a0
  47.     movl    #_end,d1
  48.     subl    a0,d1
  49.     lsrl    #2,d1
  50. bssloop:
  51.     clrl    a0@+
  52.     dbra    d1,bssloop
  53.  
  54.     jsr    _main:l        /* Call main (arguments?) */ 
  55.  
  56.     movl    0xfef00c4:l,a0    /* call v_exit_to_mon */
  57.     jsr    a0@
  58.     movl    d0,a0
  59.     jmp    a0@
  60.  
  61.     .globl    _startKernel
  62. _startKernel:
  63.     movl    sp@(4),a0    /* Expect starting address as first arg */
  64.     jmp    a0@        /* Start the kernel */
  65.  
  66.